//
//  ViewController.m
//  ProgressDemo
//
//  Created by nhope on 2017/2/9.
//  Copyright © 2017年 xiaopin. All rights reserved.
//

#import "ViewController.h"
#import "XPProgressView.h"
#import "XPScoreLevelItem.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    XPProgressView *progressView = [[XPProgressView alloc] init];
//    progressView.backgroundColor = [UIColor purpleColor];
    progressView.frame = CGRectMake(100.0, 100.0, 120.0, 120.0);
    // 设置相关属性
    progressView.progressLineWidth = 10.0;
    progressView.gradientColors = @[
                                    (id)[UIColor redColor].CGColor,
                                    (id)[UIColor yellowColor].CGColor,
                                    (id)[UIColor orangeColor].CGColor
                                    ];
    progressView.score = 5.0;
//    progressView.currentScore = 4.8;
    progressView.levelItems =
    @[
      [XPScoreLevelItem itemWithLevelName:@"等级不及格" textColor:[UIColor redColor] minValue:0.0 maxValue:3.0],
      [XPScoreLevelItem itemWithLevelName:@"等级及格" textColor:[UIColor orangeColor] minValue:3.0 maxValue:4.0],
      [XPScoreLevelItem itemWithLevelName:@"等级优秀" textColor:[UIColor greenColor] minValue:4.0 maxValue:5.0],
      ];
    progressView.separatorLineWidth = 80.0;
    
    [self.view addSubview:progressView];
}

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    XPProgressView *progressView = (XPProgressView*)self.view.subviews.lastObject;
    progressView.currentScore = 4.8;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
